FROM alpine:latest AS production
RUN apk --no-cache add ca-certificates

WORKDIR /build

COPY ./cmd/docker/main ./
COPY ./docs ./docs
COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/

ENV TZ=Asia/Shanghai

RUN echo "http://mirrors.aliyun.com/alpine/v3.4/main/" > /etc/apk/repositories \
    && apk --no-cache add tzdata zeromq \
    && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \
    && echo '$TZ' > /etc/timezone

EXPOSE 9051

ENTRYPOINT ["./main"]